BIN=code
CC=gcc
LFLAG=-o
CFLAG=-c
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)
RM=rm -f

$(BIN):$(OBJ)
	@$(CC) $(LFLAG) $@ $^
	@echo "链接$^成为$@"
%.o:%.c
	@$(CC) $(CFLAG) $<
	@echo "编译$<成为$@"

.PHONY:clean
clean:
	@$(RM) $(OBJ) $(BIN)
	@echo "清理工作完毕"

.PHONY:print
print:
	@echo $(SRC)
	@echo "-----------------"
	@echo $(OBJ)
